<?php
class WidgetCategoriesMenu extends FWidget
{
    public $selected_cat_id = 0;
    public $widgets_container_id = 'widgets-container';
    
    public function run()
    {
        // get vocabulary "Widgets"
        $widget_vol = Vocabulary::model()->find("name='Widgets'");
        if (is_null($widget_vol))
            throw new CHttpException(400,Yii::t('Core','Missing type "Widgets"'));
        // get all terms (categories) which vocabulary "Widgets"
        $cats = Term::model()->findAll('v_id=:vid AND state=1',array(':vid'=>$widget_vol->id));
        $this->render('WidgetCategoriesMenu',array('cats'=>$cats));
    }
}